FROM ubuntu:20.04

COPY sources.list /etc/apt/sources.list

RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata

RUN apt-get update && apt-get install -y \
  software-properties-common \
  curl \
  git \
  make \
  curl \
  make \
  autoconf \
  automake \
  libtool \
  g++ \
  unzip \
  default-jre \
  g++-aarch64-linux-gnu \
  net-tools \
  libhdf5-serial-dev \
  vim \
  libsqlite3-dev \
  libssl-dev \
  libcurl4-openssl-dev \
  liblapack-dev \
  liblapacke-dev \
  psmisc \
  ghostscript \
  graphviz \
  libunwind8-dev \
  libpoco-dev \
  uuid-dev \
  gfortran-aarch64-linux-gnu \
  sudo
WORKDIR /home/autox
RUN curl -sS -L --retry 3 -O \
  https://github.com/Kitware/CMake/releases/download/v3.19.4/cmake-3.19.4-Linux-x86_64.sh \
  && bash cmake-3.19.4-Linux-x86_64.sh --skip-license --prefix=/usr/local \
  && rm -f cmake-3.19.4-Linux-x86_64.sh \
  && cmake --version
RUN git config --global http.sslverify false
RUN git config --global https.sslverify false
RUN git clone https://github.com/eProsima/Fast-DDS-Gen.git \
  && cd Fast-DDS-Gen \
  && ./gradlew assemble
COPY install.sh /home/autox/
COPY linux_toolchain.cmake /code/cross_compile/
COPY fastdds.patch /code/cross_compile/
COPY glog_security.patch /code/cross_compile/
COPY pcl_boost_endian.patch /code/cross_compile/
COPY container_node_sizes_impl_linux_s32g.hpp /code/cross_compile/
RUN /home/autox/install.sh
COPY bazel-4.0.0-installer-linux-x86_64.sh /code/cross_compile/
RUN /code/cross_compile/bazel-4.0.0-installer-linux-x86_64.sh
RUN chmod 777 /deploy
RUN ldconfig
